package game

import (
	. "gddgame.cc/galaxy/common/dsl/game/attr"
	. "gddgame.cc/galaxy/common/dsl/game/object"
	"gddgame.cc/galaxy/common/service/playbook"
	"gddgame.cc/galaxy/project/maze/maze/model"
)

func (center *Center) GeneratePlayer(player *playbook.Player, user *model.User, index int) *ObjectInfo {
	// 根据用户信息，生成对象
	t := &ObjectInfo{
		Id:       index,
		Entity:   user.Entity,
		Name:     player.Open.NickName,
		Base:     center.Bases[user.BaseId],
		Category: 0,
		Identity: 1,
	}
	attr := AttrEffectSlice{}
	attrEvent := make([][]AttrEvent, 0)

	t.Extend = &model.GamePlayerExtend{
		NickName: player.Open.NickName,
		Avatar:   player.Open.Avatar,
	}

	t.Attr = attr.GenerateAttr()
	t.AttrEvent = attrEvent
	return t
}
